/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.coopeud.vista.eventos;

import edu.coopeud.vista.VentanaInicio;

/**
 *
 * @author EMMC
 */
public class VentanaEventos extends javax.swing.JFrame {

    private VentanaInicio inicio;
    private VentanaCrearEvento creaEvt;
    private VentanaAdministrarEventos admin;
    
    public VentanaEventos() {
        super("Eventos");
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnCrearEvt = new javax.swing.JButton();
        btnAdministrarEvt = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        btnCrearEvt.setText("Crear Evento");
        btnCrearEvt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCrearEvtActionPerformed(evt);
            }
        });

        btnAdministrarEvt.setText("Administrar Eventos");
        btnAdministrarEvt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdministrarEvtActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCrearEvt)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAdministrarEvt)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCrearEvt)
                    .addComponent(btnAdministrarEvt))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCrearEvtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCrearEvtActionPerformed
        cerrar();
        getCreaEvt().setVisible(true);
    }//GEN-LAST:event_btnCrearEvtActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        cerrar();
        getInicio().setVisible(true);
    }//GEN-LAST:event_formWindowClosing

    private void btnAdministrarEvtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdministrarEvtActionPerformed
        cerrar();
        getAdmin().setVisible(true);
    }//GEN-LAST:event_btnAdministrarEvtActionPerformed

    public void cerrar(){
        dispose();
    }
    
    public VentanaInicio getInicio (){
        if (inicio==null){
            inicio=new VentanaInicio();
        }
        return inicio;
    }
    
    public VentanaCrearEvento getCreaEvt(){
        if (creaEvt==null){
            creaEvt=new VentanaCrearEvento();
        }
        return creaEvt;
    }
    
    public VentanaAdministrarEventos getAdmin(){
        if (admin==null){
            admin=new VentanaAdministrarEventos();
        }
        return admin;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdministrarEvt;
    private javax.swing.JButton btnCrearEvt;
    // End of variables declaration//GEN-END:variables
}
